    {include file="../view/head" /}
    <style>
    /*页面自定义样式*/
    </style>
    </head>
    <body>
        {include file="../view/header" /}
        {include file="../view/sidebar" /}
        {include file="../view/right-sidebar" /}
        <!-- Start #content -->
        <div id="content">
            <!-- Start .content-wrapper -->
            <div class="content-wrapper">
                <div class="row">
                    <!-- Start .row -->
                    <!-- Start .page-header -->
                    <div class="col-lg-12 heading hidden-xs hidden-sm">
                        <!-- Start .bredcrumb -->
                        <ul id="crumb" class="breadcrumb">
                            <li><i class="im-pencil"></i> 编辑{$type_cn}</li>
                        </ul>
                        <!-- End .breadcrumb -->
                    </div>
                    <!-- End .page-header -->
                </div>
                <!-- End .row -->
                <div class="outlet">
                    <!-- Start .outlet -->
                    <!-- Page start here ( usual with .row ) -->
                    <div class="row">
                        <div class="col-lg-12">
                            <!-- Start col-lg-12 -->
                            <div class="panel panel-default toggle">
                                <!-- Start .panel -->
                                <div class="panel-heading">
                                    <h3 class="panel-title">编辑{$type_cn}</h3>
                                </div>
                                <div class="panel-body">
                                    <form class="form-horizontal group-border hover-stripped" action="#" method="post" enctype="multipart/form-data">
                                        {:token()}
                                        <input name="type" type="text" class="hidden" value="{$type}">
                                        <div class="form-group">
                                            <div class="col-lg-12 col-md-12">
                                                <div class="input-group">
                                                    <span class="input-group-addon">{$type_cn}标题</span>
                                                    <input name="title" type="text" class="form-control" placeholder="请输入标题" value="{$list.title}" required="">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-lg-12 col-md-12">
                                                <div class="input-group">
                                                    <span class="input-group-addon">{$type_cn}描述|副标题</span>
                                                    <textarea name="titleb" type="text" class="form-control" placeholder="请输入描述|副标题" required="">{$list.titleb}</textarea>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-lg-12 col-md-12">
                                                <div class="input-group">
                                                    <span class="input-group-addon">分类</span>
                                                    <input name="typeb" type="text" class="form-control" placeholder="请输入分类" value="{$list.typeb}">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-lg-12 col-md-12">
                                                <div class="input-group">
                                                    <span class="input-group-addon">作者</span>
                                                    <input name="zuozhe" type="text" class="form-control" placeholder="请输入作者" value="{$list.zuozhe}">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-lg-12 col-md-12">
                                                <div class="input-group">
                                                    <span class="input-group-addon">封面图</span>
                                                    <span class="input-group-addon" style="padding: 1px;">
                                                        <a href="{$list.fengmian}" target="_black"><img src="{$list.fengmian}" style="max-height: 30px;"></a>
                                                    </span>
                                                    <input name="fengmian" type="file" class="form-control">
                                                    
                                                </div>
                                            </div>
                                        </div>
                                        {if $type=='gonggao'}
                                        <div class="form-group">
                                            <div class="col-lg-12 col-md-12">
                                                <div class="input-group">
                                                    <span class="input-group-addon">是否首页弹出</span>
                                                    <!--<label><input name="is_pop" type="radio" class="form-control" value="1">是</label>
                                                   <label><input name="is_pop" type="radio" class="form-control" value="2">否</label>-->
                                                    <div class="col-md-10">
                                                        <input name="is_pop" type="radio" value='0' <?php if ($list['is_pop']==0){?> checked="checked" <?php }?> >否
                                                        <input name="is_pop" type="radio" value='1' <?php if ($list['is_pop']==1){?> checked="checked" <?php }?> >是
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        {/if}
                                        <div class="form-group">
                                            <div class="col-lg-12 col-md-12">
                                                <script id="editor" type="text/plain" style="width:100%;height:200px;"></script>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-lg-12 col-md-12">
                                                <input type="submit" class="btn btn-primary btn-block" value="发布出去">
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
<<!-- div id="btns">
    <div>
        <button onclick="getAllHtml()">获得整个html的内容</button>
        <button onclick="getContent()">获得内容</button>
        <button onclick="setContent()">写入内容</button>
        <button onclick="setContent(true)">追加内容</button>
        <button onclick="getContentTxt()">获得纯文本</button>
        <button onclick="getPlainTxt()">获得带格式的纯文本</button>
        <button onclick="hasContent()">判断是否有内容</button>
        <button onclick="setFocus()">使编辑器获得焦点</button>
        <button onmousedown="isFocus(event)">编辑器是否获得焦点</button>
        <button onmousedown="setblur(event)" >编辑器失去焦点</button>

    </div>
    <div>
        <button onclick="getText()">获得当前选中的文本</button>
        <button onclick="insertHtml()">插入给定的内容</button>
        <button id="enable" onclick="setEnabled()">可以编辑</button>
        <button onclick="setDisabled()">不可编辑</button>
        <button onclick=" UE.getEditor('editor').setHide()">隐藏编辑器</button>
        <button onclick=" UE.getEditor('editor').setShow()">显示编辑器</button>
        <button onclick=" UE.getEditor('editor').setHeight(300)">设置高度为300默认关闭了自动长高</button>
    </div>

    <div>
        <button onclick="getLocalData()" >获取草稿箱内容</button>
        <button onclick="clearLocalData()" >清空草稿箱</button>
    </div>

</div>
<div>
    <button onclick="createEditor()">
    创建编辑器</button>
    <button onclick="deleteEditor()">
    删除编辑器</button>
</div> -->


                        </div>
                    </div>
                    <!-- Page End here -->
                </div>
                <!-- End .outlet -->
            </div>
            <!-- End .content-wrapper -->
            <div class="clearfix"></div>
        </div>
        <!-- End #content -->
        {include file="../view/foot" /}
        <script src="/public/chajian/ueditor1_4_3_3-utf8-php/ueditor.config.js"></script>
        <script src="/public/chajian/ueditor1_4_3_3-utf8-php/ueditor.all.min.js"></script>
        <script src="/public/chajian/ueditor1_4_3_3-utf8-php/lang/zh-cn/zh-cn.js"></script>
        <script type="text/javascript">
            //实例化编辑器
            //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
            var ue = UE.getEditor('editor');
            ue.ready(function() {
                ue.setContent($('<div>').html('{$list.text}').text());
            });

            function isFocus(e){
                alert(UE.getEditor('editor').isFocus());
                UE.dom.domUtils.preventDefault(e)
            }
            function setblur(e){
                UE.getEditor('editor').blur();
                UE.dom.domUtils.preventDefault(e)
            }
            function insertHtml() {
                var value = prompt('插入html代码', '');
                UE.getEditor('editor').execCommand('insertHtml', value)
            }
            function createEditor() {
                enableBtn();
                UE.getEditor('editor');
            }
            function getAllHtml() {
                alert(UE.getEditor('editor').getAllHtml())
            }
            function getContent() {
                var arr = [];
                arr.push("使用editor.getContent()方法可以获得编辑器的内容");
                arr.push("内容为：");
                arr.push(UE.getEditor('editor').getContent());
                alert(arr.join("\n"));
            }
            function getPlainTxt() {
                var arr = [];
                arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容");
                arr.push("内容为：");
                arr.push(UE.getEditor('editor').getPlainTxt());
                alert(arr.join('\n'))
            }
            function setContent(isAppendTo) {
                var arr = [];
                arr.push("使用editor.setContent('欢迎使用ueditor')方法可以设置编辑器的内容");
                UE.getEditor('editor').setContent('欢迎使用ueditor', isAppendTo);
                alert(arr.join("\n"));
            }
            function setDisabled() {
                UE.getEditor('editor').setDisabled('fullscreen');
                disableBtn("enable");
            }

            function setEnabled() {
                UE.getEditor('editor').setEnabled();
                enableBtn();
            }

            function getText() {
                //当你点击按钮时编辑区域已经失去了焦点，如果直接用getText将不会得到内容，所以要在选回来，然后取得内容
                var range = UE.getEditor('editor').selection.getRange();
                range.select();
                var txt = UE.getEditor('editor').selection.getText();
                alert(txt)
            }

            function getContentTxt() {
                var arr = [];
                arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");
                arr.push("编辑器的纯文本内容为：");
                arr.push(UE.getEditor('editor').getContentTxt());
                alert(arr.join("\n"));
            }
            function hasContent() {
                var arr = [];
                arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");
                arr.push("判断结果为：");
                arr.push(UE.getEditor('editor').hasContents());
                alert(arr.join("\n"));
            }
            function setFocus() {
                UE.getEditor('editor').focus();
            }
            function deleteEditor() {
                disableBtn();
                UE.getEditor('editor').destroy();
            }
            function disableBtn(str) {
                var div = document.getElementById('btns');
                var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
                for (var i = 0, btn; btn = btns[i++];) {
                    if (btn.id == str) {
                        UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
                    } else {
                        btn.setAttribute("disabled", "true");
                    }
                }
            }
            function enableBtn() {
                var div = document.getElementById('btns');
                var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
                for (var i = 0, btn; btn = btns[i++];) {
                    UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
                }
            }

            function getLocalData () {
                alert(UE.getEditor('editor').execCommand( "getlocaldata" ));
            }

            function clearLocalData () {
                UE.getEditor('editor').execCommand( "clearlocaldata" );
                alert("已清空草稿箱")
            }
        </script>
    </body>
</html>